<?php
   
/**
 * Mapper for tphotosparameters
 * 
 * @author Martin Grossmann <snake.aas@gmail.com>
 * @version 1.0
 * @package Mappers
 *
 * @property Photo $Photo photo which belongs parameter
 * @property Parameter $Parameter 
 * @property string $Value Value of parameter. Can be null. 30 chars max
 * 
 * @entity
 * @table(name="tphotosparameters", indexes={@index(name="TPhotosParam_TParam_FK", columns="parameter"),
 *                                           @index(name="TPhotosParametersv1_TPhotos_FK", columns="idPhoto")})
 */     
class PhotosParameters {
  /**
   *
   * @access private
   * @var integer 
   * 
   * @Id
   * @column(name="idPhotoParameter", type="integer")
   * @generatedValue
   */
  private $idPhotoParameter;
  
  /**
   * @access private
   * @var Photo
   * 
   * @manyToOne(targetEntity="Photo", inversedBy="parameters")
   * @joinColumn(name="idPhoto", referencedColumnName="idPhoto")
   */
   private $photo;
         
  /**
   * @access private
   * @var Parameter
   * 
   * @manyToOne(targetEntity="Parameter")
   * @joinColumn(name="Parameter", referencedColumnName="Parameter")
   */
   private $param;
      
  /**
   * Value of parameter. Can be null.
   * 
   * @access private
   * @var string
   * 
   * @column(name="Value", type="string", length=30, nullable=true)
   */
   private $value;
     

  public function __get($name) {
 
    switch($name) {
      case "idPhotoParameter":
        return $this->idPhotoParameter;
        break;
      
      case "Photo": 
        return $this->photo;
        break;

      case "Parameter": 
        return $this->param;
        break;
    
      case "Value": 
        return $this->value;
        break;
      
      default: 
        throw new EntityException(sprintf(T_("Trying to get undefined property")." ", $name));
    }
  }
  
  public function __set($name, $value) {
   
    switch($name) {
      case "idPhotoParameter":
        $this->idPhotoParameter = Validations::validateInteger($value, 0);
        break;      
      
      case "Photo": 
        $this->photo = Validations::ValidateObject($value, 'Photo');
        break; 

      case "Parameter": 
        $this->param = Validations::ValidateObject($value, 'Parameter');
        break; 

      case "Value": 
        $this->value = $value;
        break; 

      default: 
        throw new EntityException(sprintf(T_("Trying to set undefined property")." ", $name));
    }
  }  
  
}